# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluation do
  @moduledoc """
  An evaluation is a single execution (or run) of an evaluation process. It encapsulates the state of the evaluation and the resulting data.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Timestamp the Evaluation was created at.
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Timestamp the Evaluation was completed at.
  *   `error` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus.t`, *default:* `nil`) - Output only. The error that occurred during evaluation. Only populated when the evaluation's state is FAILED.
  *   `errorSamples` (*type:* `list(GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus.t)`, *default:* `nil`) - Output only. A sample of errors encountered while processing the request.
  *   `evaluationSpec` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluationEvaluationSpec.t`, *default:* `nil`) - Required. The specification of the evaluation.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. The full resource name of the Evaluation, in the format of `projects/{project}/locations/{location}/evaluations/{evaluation}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters.
  *   `qualityMetrics` (*type:* `GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaQualityMetrics.t`, *default:* `nil`) - Output only. The metrics produced by the evaluation, averaged across all SampleQuerys in the SampleQuerySet. Only populated when the evaluation's state is SUCCEEDED.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state of the evaluation.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :endTime => DateTime.t() | nil,
          :error => GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus.t() | nil,
          :errorSamples => list(GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus.t()) | nil,
          :evaluationSpec =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluationEvaluationSpec.t()
            | nil,
          :name => String.t() | nil,
          :qualityMetrics =>
            GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaQualityMetrics.t()
            | nil,
          :state => String.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:endTime, as: DateTime)
  field(:error, as: GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus)
  field(:errorSamples, as: GoogleApi.DiscoveryEngine.V1.Model.GoogleRpcStatus, type: :list)

  field(:evaluationSpec,
    as:
      GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluationEvaluationSpec
  )

  field(:name)

  field(:qualityMetrics,
    as: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaQualityMetrics
  )

  field(:state)
end

defimpl Poison.Decoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluation do
  def decode(value, options) do
    GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluation.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DiscoveryEngine.V1.Model.GoogleCloudDiscoveryengineV1alphaEvaluation do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
